<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>位置</title>
		<script>
			function showDiv(){
				let d=document.getElementById("slogon");
				//console.log(d.previousSibling)
				//d.previousSibling.innerHTML="教育改变生活";
				d.previousElementSibling.innerHTML="教育改变生活";
				
				let u=d.nextElementSibling;
				console.log(u.childNodes.length);
				console.log(u.children.length);
				u.firstElementChild.innerHTML="西红柿";
				
				for (var i = 0; i < u.childNodes.length; i++) {
					console.log(u.childNodes[i].nodeName,u.childNodes[i].nodeType);
				}
				
			}
		</script>
	</head>
	<body>
		<h1>jiaoyu改变生活</h1>
		<div id="slogon">We change lives</div>
		<ul>
			<li>苹果</li>
			<li>榴莲</li>
			<li>波罗蜜</li>
			<li>桃子</li>
			<li>西瓜</li>
		</ul>
		<div>
			<input type="button" value="点击" onclick="showDiv()"/>
		</div>
	</body>
</html>